/*
 * FileName: SafepointTest.java
 * Author:   zzw
 * Date:     2018年11月13日
 * Description:
 */
package com.zzw.gc;

/**
 * 〈〉<br>
 * 〈〉
 *    -XX:+PrintGC
 * // -XX:+PrintGCApplicationStoppedTime
 * // -XX:+PrintSafepointStatistics
 * // -XX:+UseCountedLoopSafepoints
 * @author zzw
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本]（可选）
 */
public class SafepointTest {
    static double sum = 0;

    public static void foo() {
        for (int i = 0; i < 0x77777777; i++) {
            sum += Math.sqrt(i);
        }
    }

    public static void bar() {
        for (int i = 0; i < 50000000; i++) {
            new Object().hashCode();
        }
    }

    public static void main(String[] args) {
        new Thread(SafepointTest::foo).start();
        new Thread(SafepointTest::bar).start();
    }

}
